package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Sjgzofdg type
*/
@SuppressWarnings("ALL")
public class Sjgzofdg {


        private static volatile Sjgzofdg instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Sjgzofdg getInstance() {
            if (instance == null) {
                synchronized (Sjgzofdg.class) {
                    if (instance == null) {
                        instance = new Sjgzofdg();
                    }
                }
            }
            return instance;
        }


        private Sjgzofdg() {

        }



    public  Boolean judgeJsklybahog(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeKgbkkizbnk(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeVwxixwhxnd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeShqhxeqtfn(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeFrgzxtirvd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeNjulbbrwsq(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeXewvhlqgam(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeCflmolderk(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  jsklybahog;
    private String  kgbkkizbnk;
    private String  vwxixwhxnd;
    private String  shqhxeqtfn;
    private String  frgzxtirvd;
    private String  njulbbrwsq;
    private String  xewvhlqgam;
    private String  cflmolderk;


    public void setJsklybahog(String jsklybahog){
    this.jsklybahog = jsklybahog;
    }

    public String getJsklybahog(){
    return this.jsklybahog;
    }
    public void setKgbkkizbnk(String kgbkkizbnk){
    this.kgbkkizbnk = kgbkkizbnk;
    }

    public String getKgbkkizbnk(){
    return this.kgbkkizbnk;
    }
    public void setVwxixwhxnd(String vwxixwhxnd){
    this.vwxixwhxnd = vwxixwhxnd;
    }

    public String getVwxixwhxnd(){
    return this.vwxixwhxnd;
    }
    public void setShqhxeqtfn(String shqhxeqtfn){
    this.shqhxeqtfn = shqhxeqtfn;
    }

    public String getShqhxeqtfn(){
    return this.shqhxeqtfn;
    }
    public void setFrgzxtirvd(String frgzxtirvd){
    this.frgzxtirvd = frgzxtirvd;
    }

    public String getFrgzxtirvd(){
    return this.frgzxtirvd;
    }
    public void setNjulbbrwsq(String njulbbrwsq){
    this.njulbbrwsq = njulbbrwsq;
    }

    public String getNjulbbrwsq(){
    return this.njulbbrwsq;
    }
    public void setXewvhlqgam(String xewvhlqgam){
    this.xewvhlqgam = xewvhlqgam;
    }

    public String getXewvhlqgam(){
    return this.xewvhlqgam;
    }
    public void setCflmolderk(String cflmolderk){
    this.cflmolderk = cflmolderk;
    }

    public String getCflmolderk(){
    return this.cflmolderk;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}